#coding=utf-8 
'''
Created on 2012-8-28
@author: gazhang
'''
#http://blog.csdn.net/v_JULY_v/article/details/6057286
#problem 9

import node;

def postToBinaryTree(_list):
    if len(_list)==0:
        return None
    head=node.node(None,None,_list.pop());
    index=0;
    while (index!=len(_list)):
        if(_list[index]<=head.value):
            index=index+1
            continue
        else:
            break
    head._left=postToBinaryTree(_list[:index])
    head._right=postToBinaryTree(_list[index:])
    return head

_list=[5,7,6,9,11,10,8]
head=postToBinaryTree(_list)
node.mid_order(head)

    
